package io.github.i678.namedutils.api.utils;

import org.bukkit.Bukkit;
import org.bukkit.entity.Player;

public class ChatUtils {

    public static void broadcast(String msg, String permission) {
        if(msg == null || msg.equals("")) throw new NullPointerException();
        for(Player p : Bukkit.getOnlinePlayers()) {
            if(permission != null) {
                if(p.hasPermission(permission)) {
                    p.sendMessage(msg);
                }
            } else {
                p.sendMessage(msg);
            }
        }
    }

}